**// Publication Bias
*************
**// Panel A
*************
**// Reproduction
clear
cd "\\file\UsersW$\wrr15\Home\My Documents\My Files\REPLICATION OF ZIGRAIOVA AND HAVRANEK (2016)\REVISION FOR JOES"

log using "TABLE5.smcl", replace

use "Z&Hcompetition.dta"
set more off
gen double invSEPCC = 1/SEPCC
gen double lnobs = ln(Samplesize)
gen double invlnobs=1/lnobs
xtset IDStudy
eststo: xtreg t invSEPCC, fe vce(cluster IDStudy)
eststo: xtreg t invSEPCC if reviewed_journal==1, fe vce(cluster IDStudy)
eststo: xtivreg t (invSEPCC=invlnobs), fe
eststo: xtivreg t (invSEPCC=invlnobs) if reviewed_journal==1, fe
eststo: xtreg t invSEPCC [pweight=investperst], fe vce(cluster IDStudy)
eststo: xtreg t invSEPCC [pweight=investperst] if reviewed_journal==1, ///
fe vce(cluster IDStudy)

**// Replication
clear
use "all.dta"
gen invvariance = i/(SEPCC^2)
set more off
gen double invSEPCC = 1/SEPCC
gen double lnobs = ln(Samplesize)
gen double invlnobs=1/lnobs
xtset IDStudy
eststo: xtreg t invSEPCC, fe vce(cluster IDStudy)
eststo: xtreg t invSEPCC if reviewed_journal==1, fe vce(cluster IDStudy)
eststo: xtivreg t (invSEPCC=invlnobs), fe
eststo: xtivreg t (invSEPCC=invlnobs) if reviewed_journal==1, fe
eststo: xtreg t invSEPCC [pweight=investperst], fe vce(cluster IDStudy)
eststo: xtreg t invSEPCC [pweight=investperst] if reviewed_journal==1, ///
fe vce(cluster IDStudy)
// weighted (WLS)
eststo: reg t invSEPCC, vce(cluster IDStudy)
eststo: reg t invSEPCC if reviewed_journal==1, vce(cluster IDStudy)




*************
**// Panel B
*************
**// OLS
clear
use "Z&Hcompetition.dta"
set more off
xtset IDStudy
gen double lnobs = ln(Samplesize)
ivreg2 PCC SEPCC dummies Hstatistic developed undeveloped Logit lnobs ///
citations firstpub quadratic Boone IFrecursive regulation OLS ///
reviewed_journal [pweight=investperst], cluster (IDStudy)


clear
use "all.dta"
gen invvariance = 1/(SEPCC^2)
set more off
gen double lnobs = ln(Samplesize)
xtset IDStudy
**// weighted
ivreg2 PCC Logit citations_2019 OLS reviewed_journal Concentration ///
global  ownership  firstpub SEPCC lnobs IFrecursive_2019 DtoD ///
FE Hstatistic endogeneity sampleyear HHI dummies macro ///
[pweight=investperst], cluster (IDStudy)


// Weighted (WLS)
ivreg2 PCC lnobs firstpub quadratic Lerner Zscore profit_volat ///
SEPCC GMM NPL global DtoD Hstatistic sampleyear developed undeveloped ///
someAveraged OLS citations_2019 Boone capitalization reviewed_journal ///
RE profitability Concentration endogeneity ownership Logit ///
HHI SLS dummies T macro FE IFrecursive_2019 regulation [pweight=invvariance], cluster (IDStudy)

log close
